//
//  ViewController.m
//  07-VC生命周期
//
//  Created by dllo on 16/7/22.
//  Copyright © 2016年 YMJ. All rights reserved.
//

#import "ViewController.h"
#import "NextViewController.h"

@interface ViewController ()

@end

@implementation ViewController
#pragma mark - loadView 和 viewDidLoad 只会加载一次
- (void)loadView {
    [super loadView];
    NSLog(@"%@---%s",[self class],__FUNCTION__);
}
- (void)viewDidLoad {
    [super viewDidLoad];
    NSLog(@"%@---%s",[self class],__FUNCTION__);
    self.view.backgroundColor = [UIColor redColor];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(click:)];
    // Do any additional setup after loading the view, typically from a nib.
}
#pragma mark - viewWillAppear viewDidAppear 加载该页面可重复,前者在出现的路上都触发,后者出现完全才触发,消失disAppare同理
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:YES];
    NSLog(@"%@---%s",[self class],__FUNCTION__);
}
- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:YES];
    NSLog(@"%@---%s",[self class],__FUNCTION__);
}
- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:YES];
    NSLog(@"%@---%s",[self class],__FUNCTION__);
}
- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:YES];
    NSLog(@"%@---%s",[self class],__FUNCTION__);
}
- (void)click:(UIBarButtonItem *)bar {
    [self.navigationController pushViewController:[NextViewController new] animated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
